<%-- 
    Document   : addEditContest
    Created on : 23/04/2011, 06:50:36 PM
    Author     : Jhon
--%>
<%@page import="vo.VOContest"%>
<%@page import="java.util.Date"%>
<%@page import="control.Controller"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%  String cname =  request.getParameter("cname");
    String ccode=  request.getParameter("ccode");
    String sdateY= request.getParameter("sdateY");
    String sdateM= request.getParameter("sdateM");
    String sdateD= request.getParameter("sdateD");
    String stimeH= request.getParameter("stimeH");
    String stimeM= request.getParameter("stimeM");
    String stimeS= request.getParameter("stimeS");
    String edateY= request.getParameter("sdateY");
    String edateM= request.getParameter("sdateM");
    String edateD= request.getParameter("sdateD");
    String etimeH= request.getParameter("stimeH");
    String etimeM= request.getParameter("stimeM");
    String etimeS= request.getParameter("stimeS");

    if(cname ==null || cname=="" || ccode==null || ccode =="" || sdateY==null || sdateY==""
            || sdateM==null || sdateM=="" || sdateD==null || sdateD=="" || edateM==null || edateM==""
            || edateY==null || edateY=="" || edateD==null || edateD=="" || etimeH==null || etimeH==""
            || etimeM==null || etimeM=="" || etimeS==null || etimeS=="" || stimeH==null || stimeH==""
            || stimeM==null || stimeM=="" || stimeS==null || stimeS==""){
    response.sendRedirect("SubirSolucion.jsp");
    return;
    }
    Controller con = Controller.getInstance();
    VOContest p = (VOContest) session.getAttribute("CONTEST");
    p.setContestCode(ccode);
    p.setName(cname);
    p.setStart(new Date(Integer.parseInt(sdateY)-1900, Integer.parseInt(sdateM)-1, Integer.parseInt(sdateD), Integer.parseInt(stimeH), Integer.parseInt(stimeM), Integer.parseInt(stimeS)));
    p.setEnd(new Date(Integer.parseInt(edateY)-1900, Integer.parseInt(edateM)-1, Integer.parseInt(edateD), Integer.parseInt(etimeH), Integer.parseInt(etimeM), Integer.parseInt(etimeS)));
    try{
    boolean bien = con.editContest(p);
    }catch(Exception e){
        session.setAttribute("ERROR", e.getMessage());
        response.sendRedirect("../Error/Error.jsp");
        return;
    }
    response.sendRedirect("./BuscarContest.jsp");
    %>